<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
	echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
	exit;
}



$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/location.tpl");
	
	//------------ begin switch page type options ------------//
	
	// ---------- prod category
	switch ($_GET['case']) {
	case "products":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'products/'.strip_tags($_GET['pc']).'.html">'.str_replace("-", " ", strip_tags($_GET['pc'])).'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=products&pc='.str_replace(" ", "+", strip_tags($_GET['pc'])).'">'.strip_tags($_GET['pc']).'</a>');
		}
	break;
	
	// ---------- prod brand
	case "subproducts":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'products/'.strip_tags($_GET['pc']).'.html">'.str_replace("-", " ", strip_tags($_GET['pc'])).'</a> &raquo; <a href="'.$installDir['value'].'subproducts/'.strip_tags($_GET['pc']).'/'.strip_tags($_GET['pb']).'.html">'.str_replace("-", " ", strip_tags($_GET['pb'])).'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=products&pc='.str_replace(" ", "+", strip_tags($_GET['pc'])).'">'.strip_tags($_GET['pc']).'</a> &raquo; <a href="'.$installDir['value'].'index.php?case=subproducts&pc='.str_replace(" ", "+", strip_tags($_GET['pc'])).'&pb='.str_replace(" ", "+", strip_tags($_GET['pb'])).'">'.strip_tags($_GET['pb']).'</a>');
		}
	break;
	
	// ---------- prod page
	case "product":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'product/'.strip_tags($_GET['proddb']).'/'.strip_tags($_GET['pid']).'/'.urltxt($row_product['prodName']).'.html">'.$row_product["prodName"].'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=product&proddb='.strip_tags($_GET['proddb']).'&pid='.strip_tags($_GET['pid']).'">'.$row_product["prodName"].'</a>');
		}
	break;
	
	// ---------- search
	case "search":
	$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=search&ps='.str_replace(" ", "+", strip_tags($_GET['ps'])).'">'.strip_tags($_GET['ps']).'</a>');
	break;
	
	// ---------- built nav top
	case "categories":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'categories/'.strip_tags($_GET['nc']).'/'.urltxt($navC['name']).'.html">'.$navC['name'].'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=categories&nc='.strip_tags($_GET['nc']).'">'.$navC['name'].'</a>');
		}
	break;
	
	// ---------- built nav sub
	case "subcategories":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'categories/'.strip_tags($_GET['nc']).'/'.urltxt($navC['name']).'.html">'.$navC['name'].'</a> &raquo; <a href="'.$installDir['value'].'subcategories/'.strip_tags($_GET['nc']).'/'.strip_tags($_GET['nb']).'/'.urltxt($navC['name']).'/'.urltxt($navB['name']).'.html">'.$navB['name'].'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=categories&nc='.strip_tags($_GET['nc']).'">'.$navC['name'].'</a> &raquo; <a href="'.$installDir['value'].'index.php?case=subcategories&nc='.strip_tags($_GET['nc']).'&nb='.strip_tags($_GET['nb']).'">'.$navB['name'].'</a>');
		}
	break;
	
	// ---------- page top
	case "page":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'page/'.strip_tags($_GET['page']).'/'.urltxt($pageDetails['name']).'.html">'.$pageDetails['name'].'</a>');
		} else {
		// php link
		// if has parent = 0
			if($pageDetails['parent'] == 0){
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=page&page='.strip_tags($_GET['page']).'">'.$pageDetails['name'].'</a>');	
			}
			else {
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=page&page='.strip_tags($pageDetails['parent_id']).'">'.$pageDetails['parent_name'].'</a> &raquo; <a href="'.$installDir['value'].'index.php?case=page&page='.strip_tags($_GET['page']).'">'.$pageDetails['name'].'</a>');				
			}
		}
	break;
	
	// ---------- page sub
	case "subpage":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'page/'.strip_tags($_GET['page']).'/'.urltxt($pageDetails['name']).'.html">'.$pageDetails['name'].'</a> &raquo; <a href="'.$installDir['value'].'subpage/'.strip_tags($_GET['page']).'/'.strip_tags($_GET['subpage']).'/'.urltxt($pageSubDetails['name']).'.html">'.$pageSubDetails['name'].'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=page&page='.strip_tags($_GET['page']).'">'.$pageDetails['name'].'</a> &raquo; <a href="'.$installDir['value'].'index.php?case=subpage&page='.strip_tags($_GET['page']).'&subpage='.strip_tags($_GET['subpage']).'">'.$pageSubDetails['name'].'</a>');
		}
	break;
	
	// ---------- merchant comments
	case "stores":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'stores/'.strip_tags($_GET['merchant']).'.html">'.str_replace('-', ' ', strip_tags($_GET['merchant'])).'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=stores&merchant='.strip_tags($_GET['merchant']).'">'.str_replace('-', ' ', strip_tags($_GET['merchant'])).'</a>');
		}
	break;
	
	// ---------- news homepage
	case "news":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'news/home.html">News</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=news&npag=home">News</a>');
		}
	break;
	
	// ---------- news item
	case "newsitem":
		if ($navOpt[7] == 1) {
		// html perma
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'news/home.html">News</a> &raquo; <a href="'.$installDir['value'].'newsitem/'.strip_tags($_GET['npag']).'/'.urltxt($newsItemsSingle['name']).'.html">'.$newsItemsSingle['name'].'</a>');
		} else {
		// php link
		$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=news&npag=home">News</a> &raquo; <a href="'.$installDir['value'].'index.php?case=newsitem&npag='.strip_tags($_GET['npag']).'">'.$newsItemsSingle['name'].'</a>');
		}
	break;
	
	// ---------- links
	case "links":
	// get the category listings
	$sql = sprintf("SELECT * FROM affiliSt_linkcategories WHERE id = %d",
	quote_smart($_GET['cat']));
	$getLocationLink = mysql_query($sql, $databaseConnect) or die(mysql_error());
	$locationLink = mysql_fetch_assoc($getLocationLink);
	
		if (isset($_GET['cat'])) {
			
			if ($locationLink['parent'] == 0) {
			
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LOCATION", '<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'links/1.html">Links</a> &raquo; <a href="'.$installDir['value'].'links/1/'.$locationLink['id'].'.html">'.$locationLink['name'].'</a>');
				} else {
				// php link
				$box_content->assign("LOCATION", '<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1">Links</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1&cat='.$locationLink['id'].'">'.$locationLink['name'].'</a>');
				}
			
			} else {
			
			// get the parent listings
			$sql = sprintf("SELECT * FROM affiliSt_linkcategories WHERE id = %d",
			quote_smart($locationLink['parent']));
			$getParentLink = mysql_query($sql, $databaseConnect) or die(mysql_error());
			$parentLink = mysql_fetch_assoc($getParentLink);
			
			
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LOCATION", '<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'links/1.html">Links</a> &raquo; <a href="'.$installDir['value'].'links/1/'.$parentLink['id'].'.html">'.$parentLink['name'].'</a> &raquo; <a href="'.$installDir['value'].'links/1/'.$locationLink['id'].'.html">'.$locationLink['name'].'</a>');
				} else {
				// php link
				$box_content->assign("LOCATION", '<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1">Links</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1&cat='.$parentLink['id'].'">'.$parentLink['name'].'</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1&cat='.$locationLink['id'].'">'.$locationLink['name'].'</a>');
				}
				
			}
		
		// add link
		} else if (isset($_GET['add'])) {
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LOCATION", '<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'links/1.html">Links</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1&add=1">Add a Link</a>');
				} else {
				// php link
				$box_content->assign("LOCATION", '<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1">Links</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1&add=1">Add a Link</a>');
				}
			
		//links home
		} else {
			if ($navOpt[7] == 1) {
			// html perma
			$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'links/1.html">Links</a>');
			} else {
			// php link
			$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=links&ld=1">Links</a>');
			}
		}
	break;
	// ---------- account
	case 'account':
		switch ($_GET['act']){
			case 'login':
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=account&act=login">Login</a>');
				} else {
				// php link
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=account&act=login">Login</a>');
				}
				break;
			case 'register':
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=account&act=register">Register</a> &raquo; Step '.$_SESSION['registerStep']);
				} else {
				// php link
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=account&act=register">Register</a> &raquo; Step '.$_SESSION['registerStep']);
				}				
				break;
			case 'forgotpassword':
				if ($navOpt[7] == 1) {
				// html perma
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=account&act=forgotpassword">Forgot Password</a>');
				} else {
				// php link
				$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a> &raquo; <a href="'.$installDir['value'].'index.php?case=account&act=forgotpassword">Forgot Password</a>');
				}
				break;
		}
	break;
	// ---------- homepage and default setting
	default:
	$box_content->assign("LOCATION",'<a href="'.$installDir['value'].'">Home</a>');
	
	// end switch ->
	}
	
$box_content->assign("DATA", "You are here: ");

$box_content->assign("SKIN",$configSkin['value']);
$box_content->parse("location");
$box_content = $box_content->text("location");
?>